import React from 'react'
import { ActivityIndicator } from 'react-native'
import Teaset from 'teaset'

const { Toast, Theme } = Teaset

let customKey = null

Toast.showLoading = (text, duration=10000) => {
  if(customKey)return
  customKey = Toast.show({
    text, 
    icon:<ActivityIndicator size='large' color={Theme.toastIconTintColor} />,
    position: 'center',
    duration: duration
  })
}

Toast.hideLoading = () => {
  if(!customKey)return
  Toast.hide(customKey)
  customKey = null
}

export default Toast

